#include "mainscene.h"
#include"gamescene1.h"
#include"gamescene2.h"
#include"gamescene3.h"
#include"stock.h"
#include <QApplication>
#include<QObject>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MainScene* w = new MainScene;

    GameScene1* ga1 = new GameScene1;
    GameScene3* ga3 = new GameScene3;
    GameScene2* ga2 = new GameScene2;

    defeatscene* de = new defeatscene;
    victoryscene* vi = new victoryscene;
    setscene* se = new setscene;
    Helper* hel = new Helper;

    QObject::connect(w,&MainScene::showsetscene,se,&setscene::show_out);

    QObject::connect(ga1,&GameScene1::defeat,de,&defeatscene::show_time);

    QObject::connect(ga1,&GameScene1::victory,vi,&victoryscene::showtime);

    QObject::connect(ga2,&GameScene2::defeat,de,&defeatscene::show_time);

    QObject::connect(ga2,&GameScene2::victory,vi,&victoryscene::showtime);

    QObject::connect(ga3,&GameScene3::defeat,de,&defeatscene::show_time);

    QObject::connect(ga3,&GameScene3::victory,vi,&victoryscene::showtime);

    QObject::connect(de,&defeatscene::replay,w,&MainScene::reshow);

    QObject::connect(vi,&victoryscene::vreplay,w,&MainScene::reshow);

    QObject::connect(se,&setscene::show_g1,ga1,&GameScene::receivestart);

    QObject::connect(se,&setscene::show_g2,ga2,&GameScene2::receivestart);

    QObject::connect(se,&setscene::show_g3,ga3,&GameScene3::receivestart);

    QObject::connect(w,&MainScene::showhelper,hel,&Helper::show_helper);

    w->show();

    return a.exec();
}
